<template>
  <view>
    <view class="my-settle-container">
      <label class="radio" @click="changeAllState">
        <radio color="#c00000" :checked="isFullCheck" /><text>全选</text>
      </label>
      
      <view class="amount-box">
        合计:<text class="amount">${{checkedGoodsAmount}}</text>
      </view>
      
      <view class="btn-settle">结算({{checkedCount}})</view>
    </view>
  </view>
</template>

<script>
  import { mapGetters, mapMutations} from 'vuex'
  export default {
    name:"my-settle",
    data() {
      return {
        
      };
    },
    computed:{
      ...mapGetters('m_cart',['checkedCount','total','checkedGoodsAmount']),
      // 是否全选
      isFullCheck(){
        return this.total === this.checkedCount
      }
    },
    methods:{
      ...mapMutations('m_cart', ['updateAllGoodsState']),
      changeAllState(){
        this.updateAllGoodsState(!this.isFullCheck)
      }
    },
  }
</script>

<style lang="scss">
.my-settle-container{
  height: 50px;
  width: 100%;
  background-color: white;
  position: fixed;
  left: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 5px;
}
.radio{
  display: flex;
  align-items: center;
}
.amount{
  color: #c00000;
}
.btn-settle{
  height: 50px;
  min-width: 100px;
  background-color: #c00000;
  color: white;
  line-height: 50px;
  text-align: center;
  padding: 0 10px;
}
</style>
